package com.whg.demo.conf;

import com.whg.demo.interceptor.LoginInterceptor;
import com.whg.demo.interceptor.RequestInterceptor;
import com.whg.demo.interceptor.TwoInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author whg
 * @create 2022/12/2 17:12
 * @description：
 */
@Configuration
public class CustomWebMvcConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new RequestInterceptor()).addPathPatterns("/*/*/**");
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/api2/*/**")
                .excludePathPatterns("/api2/v2/**");
        registry.addInterceptor(new TwoInterceptor()).addPathPatterns("/api2/*/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
